#ifndef RWLock_h
#define RWLock_h
#include <iostream>
#include <semaphore.h>

class RWLock {
    public:
        RWLock();
        ~RWLock();
        void rlock();
        void wlock();
        void runlock();
        void wunlock();

    private:
        
	sem_t sem_room;
	sem_t sem_turn;
    
	//LightSwitch
	sem_t sem_LSwitchMutex;
	int countReaders;
	void LSwitchLock(sem_t *s);
	void LSwitchUnlock(sem_t *s);
};

#endif
